import { ColumnProps } from "@/components/ProTable/interface";
import {roleLevelEnum, statusEnum} from "@/config/enums/serviceDict";

export function role() {
  const columns: ColumnProps[] = [
    { type: "selection", fixed: "left", width: 80 },
    { type: "index", label: "#", width: 80 },
    // { type: "expand", label: "Expand", width: 100 },
    {
      prop: "name",
      label: "角色名称",
      search: { el: "input", props: { placeholder: "请输入角色名称", style: "width: 180px;" } }
    },
    {
      prop: "is_admin",
      label: "是否超管",
      isShow: false,
      enum: [
        { label: "是", value: 1 },
        { label: "否", value: 0 }
      ],
      search: { el: "select", props: { placeholder: "是否超管", style: "width: 100px" } }
    },
    {
      prop: "level",
      label: "角色等级",
      isShow: false,
      enum: roleLevelEnum,
      search: { el: "select", props: { placeholder: "角色等级", style: "width: 120px"}}
    },
    {
      prop: "level_name",
      label: "角色等级",
      width: 150,
    },
    {
      prop: "sort",
      label: "排序",
      width: 150
    },
    {
      prop: "status",
      label: "状态",
      width: 100,
      enum: statusEnum,
      search: { el: "select", props: { placeholder: "角色状态", style: "width: 100px;" } }
    },
    {
      prop: "create_time",
      label: "创建时间",
      width: 180,
      search: {
        el: "date-picker",
        key: "dateTimeRange",
        props: { type: "datetimerange", valueFormat: "YYYY-MM-DD HH:mm:ss", clearable: true, style: "width: 240px;" }
      }
    },
    { prop: "operation", label: "操作", fixed: "right", width: 320 }
  ];
  return { columns };
}
